﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NewAI;

namespace NewAI.Game
{
    public struct Position
    {
        private int x, y;

        public Position(int x, int y)
        {
            this.x = x;
            this.y = y;
        }


        public int X
        {
            get
            {
                return x;
            }
        }

        public int Y
        {
            get
            {
                return y;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        public void setPosition(int x, int y)
        {
            this.x = x;
            this.y = y;
        }
    }
    public class Bullet
    {
        private BulletType type;
        private int teamID;
        private Position position;
        private Direction direction;

        public BulletType Type
        {
            get
            {
                return type;
            }
        }

        public int TeamID
        {
            get
            {
                return teamID;
            }
        }

        internal Position Position
        {
            get
            {
                return position;
            }
        }

        public Direction Direction
        {
            get
            {
                return direction;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <param name="position"></param>
        /// <param name="dir"></param>
        public Bullet(BulletType type, int teamID, Position position, Direction dir)
        {
            this.type = type;
            this.teamID = teamID;
            this.position = position;
            this.direction = dir;
        }
    }
    public class Player
    {
        private int id;
        private int teamID;
        private Position position;
        private bool hasSuperBullet;

        public int Id
        {
            get
            {
                return id;
            }
        }

        public int TeamID
        {
            get
            {
                return teamID;
            }
        }

        internal Position Position
        {
            get
            {
                return position;
            }
        }

        public bool HasSuperBullet
        {
            get
            {
                return hasSuperBullet;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="teamID"></param>
        /// <param name="position"></param>
        /// <param name="hasSuper"></param>
        public Player(int id, int teamID, Position position, bool hasSuper)
        {
            this.id = id;
            this.teamID = teamID;
            this.position = position;
            this.hasSuperBullet = hasSuper;
        }
    }
    public class Team
    {
        private int teamID;
        private int point;
        private int remainLife;

        public int TeamID
        {
            get
            {
                return teamID;
            }
        }

        public int Point
        {
            get
            {
                return point;
            }
        }

        public int RemainLife
        {
            get
            {
                return remainLife;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="point"></param>
        /// <param name="remainLife"></param>
        public Team(int id, int point, int remainLife)
        {
            this.teamID = id;
            this.point = point;
            this.remainLife = remainLife;
        }
    }
    public class Goods
    {
        private Position position;
        private ElementType elementType;

        public Position Position
        {
            get
            {
                return position;
            }
        }

        public ElementType ElementType
        {
            get
            {
                return elementType;
            }
        }

        public void setPosition(Position p)
        {
            position.setPosition(p.X, p.Y);
        }
        public void setType(ElementType eleType)
        {
            elementType = eleType;
        }
    }
    public class BrickWall : Goods
    {
        public BrickWall(Position p)
        {
            setPosition(p);
            base.setType(ElementType.BrickWall);
        }
    }
    public class IronWall : Goods
    {
        public IronWall(Position p)
        {
            setPosition(p);
            base.setType(ElementType.IronWall);
        }

    }
    public class River : Goods
    {
        public River(Position p)
        {
            setPosition(p);
            base.setType(ElementType.River);
        }
    }
    public class Star : Goods
    {
        public Star(Position p)
        {
            setPosition(p);
            base.setType(ElementType.Star);
        }
    }
    public class Coin : Goods
    {
        int point;
        public Coin(Position p, int point)
        {
            setPosition(p);
            this.point = point;
            base.setType(ElementType.Coin);
        }

        public int Point
        {
            get
            {
                return point;
            }
        }
    }

    public class RoundData
    {
        private int roundID;
        private List<Goods> goods;
        private List<Bullet> bullets;
        private List<Player> players;
        private List<Team> teams;

        public RoundData(int roundID, List<Goods> goods, List<Bullet> bullets, List<Player> players, List<Team> teams)
        {
            this.roundID = roundID;
            this.goods = goods;
            this.bullets = bullets;
            this.players = players;
            this.teams = teams;
        }

        public int RoundID { get => roundID; }
        public List<Goods> Goods { get => goods; }
        public List<Bullet> Bullets { get => bullets; }
        public List<Player> Players { get => players; }
        public List<Team> Teams { get => teams; }
    }
}
